package org.seckill.dto;

import org.seckill.enums.SeckillStateEnum;
import org.seckill.model.SeckillView;

/**
 * 封装秒杀执行后的结果
 * @author Wrb
 * @date 2019/7/3 16:34
 */
public class SeckillExecution {

	private long seckillId;

	//秒杀执行结果状态
	private int state;

	//状态表示
	private String stateInfo;

	//秒杀成功对象
	private SeckillView seckillView;

	public SeckillExecution(long seckillId, SeckillStateEnum seckillStateEnum, SeckillView seckillView) {
		this.seckillId = seckillId;
		this.state = seckillStateEnum.getState();
		this.stateInfo = seckillStateEnum.getStateInfo();
		this.seckillView = seckillView;
	}

	public SeckillExecution(long seckillId, SeckillStateEnum seckillStateEnum) {
		this.seckillId = seckillId;
		this.state = seckillStateEnum.getState();
		this.stateInfo = seckillStateEnum.getStateInfo();
	}

	public long getSeckillId() {
		return seckillId;
	}

	public void setSeckillId(long seckillId) {
		this.seckillId = seckillId;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public String getStateInfo() {
		return stateInfo;
	}

	public void setStateInfo(String stateInfo) {
		this.stateInfo = stateInfo;
	}

	public SeckillView getSeckillView() {
		return seckillView;
	}

	public void setSeckillView(SeckillView seckillView) {
		this.seckillView = seckillView;
	}

	@Override
	public String toString() {
		return "SeckillExecution{" +
				"seckillId=" + seckillId +
				", state=" + state +
				", stateInfo='" + stateInfo + '\'' +
				", seckillView=" + seckillView +
				'}';
	}
}
